/*
 * Copyright (c) 2024-2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


// WARNING! THIS FILE IS AUTO-GENERATED, DO NOT MAKE CHANGES, THEY WILL BE LOST ON NEXT GENERATION!

import { int32, float32 } from "@koalaui/common"
import { KStringPtr, KBoolean, RuntimeType, runtimeType, isResource, isInstanceOf } from "@koalaui/interop"
import { NodeAttach, remember } from "@koalaui/runtime"
import { ComponentBase } from "./ComponentBase"
import { TypeChecker } from "#components"
import { ArkCommonMethodComponent } from "./ArkCommon"
import { ArkPatternLockPeer } from "./peers/ArkPatternLockPeer"
import { UseEventsProperties } from "./use_properties"
import { CommonMethod } from "./ArkCommonInterfaces"
import { PatternLockAttribute, CircleStyleOptions } from "./ArkPatternLockInterfaces"
import { Length, ResourceColor } from "./ArkUnitsInterfaces"
import { Callback_Array_Number_Void, Callback_Number_Void } from "./SyntheticDeclarations"
import { PatternLockController } from "./ArkPatternLockControllerMaterialized"
/** @memo:stable */
export class ArkPatternLockComponent extends ArkCommonMethodComponent {
    getPeer(): ArkPatternLockPeer {
        return (this.peer as ArkPatternLockPeer)
    }
    /** @memo */
    public setPatternLockOptions(controller?: PatternLockController): this {
        if (this.checkPriority("setPatternLockOptions")) {
            const controller_casted = controller as (PatternLockController | undefined)
            this.getPeer()?.setPatternLockOptionsAttribute(controller_casted)
            return this
        }
        return this
    }
    /** @memo */
    public sideLength(value: Length): this {
        if (this.checkPriority("sideLength")) {
            const value_casted = value as (Length)
            this.getPeer()?.sideLengthAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public circleRadius(value: Length): this {
        if (this.checkPriority("circleRadius")) {
            const value_casted = value as (Length)
            this.getPeer()?.circleRadiusAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public backgroundColor(value: ResourceColor): this {
        if (this.checkPriority("backgroundColor")) {
            const value_casted = value as (ResourceColor)
            this.getPeer()?.backgroundColorAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public regularColor(value: ResourceColor): this {
        if (this.checkPriority("regularColor")) {
            const value_casted = value as (ResourceColor)
            this.getPeer()?.regularColorAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public selectedColor(value: ResourceColor): this {
        if (this.checkPriority("selectedColor")) {
            const value_casted = value as (ResourceColor)
            this.getPeer()?.selectedColorAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public activeColor(value: ResourceColor): this {
        if (this.checkPriority("activeColor")) {
            const value_casted = value as (ResourceColor)
            this.getPeer()?.activeColorAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public pathColor(value: ResourceColor): this {
        if (this.checkPriority("pathColor")) {
            const value_casted = value as (ResourceColor)
            this.getPeer()?.pathColorAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public pathStrokeWidth(value: number | string): this {
        if (this.checkPriority("pathStrokeWidth")) {
            const value_casted = value as (number | string)
            this.getPeer()?.pathStrokeWidthAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public onPatternComplete(value: ((input: Array<number>) => void)): this {
        if (this.checkPriority("onPatternComplete")) {
            const value_casted = value as (((input: Array<number>) => void))
            this.getPeer()?.onPatternCompleteAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public autoReset(value: boolean): this {
        if (this.checkPriority("autoReset")) {
            const value_casted = value as (boolean)
            this.getPeer()?.autoResetAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public onDotConnect(value: ((index: number) => void)): this {
        if (this.checkPriority("onDotConnect")) {
            const value_casted = value as (((index: number) => void))
            this.getPeer()?.onDotConnectAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public activateCircleStyle(value?: CircleStyleOptions): this {
        if (this.checkPriority("activateCircleStyle")) {
            const value_casted = value as (CircleStyleOptions | undefined)
            this.getPeer()?.activateCircleStyleAttribute(value_casted)
            return this
        }
        return this
    }
    public applyAttributesFinish(): void {
        // we calls this function outside of class, so need to make it public
        super.applyAttributesFinish()
    }
}

/** @memo */
export function ArkPatternLock(
  /** @memo */
  style: ((attributes: ArkPatternLockComponent) => void) | undefined,
  /** @memo */
  content_: (() => void) | undefined,
  controller?: PatternLockController | undefined
) {
    const receiver = remember(() => {
        return new ArkPatternLockComponent()
    })
    NodeAttach<ArkPatternLockPeer>((): ArkPatternLockPeer => ArkPatternLockPeer.create(receiver), (_: ArkPatternLockPeer) => {
        receiver.setPatternLockOptions(controller)
        style?.(receiver)
        content_?.()
        receiver.applyAttributesFinish()
    })
}
